home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / gemsiv / vec_mat / algebra3.c next >
Encoding:
Text File  |  1994-05-16  |  22.8 KB  |  801 lines

  1.  := 0;
  2.       end;
  3.     end;
  4.   end;
  5.   WaitToGo;
  6. end; { UserLineStylePlay }
  7.  
  8.  
  9. procedure SayGoodbye;
  10. { Say goodbye and then exit the program }
  11. var
  12.   ViewInfo : ViewPortType;
  13. begin
  14.   MainWindow('');
  15.   GetViewSettings(ViewInfo);
  16.   SetTextStyle(TriplexFont, HorizDir, 4);
  17.   SetTextJustify(CenterText, CenterText);
  18.   with ViewInfo do
  19.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  20.   StatusLine('Press any key to quit...');
  21.   repeat until KeyPressed;
  22. end; { SayGoodbye }
  23.  
  24.  
  25. PROCEDURE SelectMode;
  26. VAR
  27.     choice1,choice2     : CHAR;
  28.    xsize,ysize            : WORD;
  29. BEGIN
  30.     (* Let's select a mode *)
  31.     ClrScr;
  32.     WriteLn('VESADEMO:');
  33.     WriteLn('1. 256 colors');
  34.     WriteLn('2. 32768 colors');
  35.     WriteLn('3. 65536 colors');
  36.     WriteLn('4. 16777216 colors');
  37.     WriteLn('Q uit');
  38.     WriteLn;
  39.     Write('Your choice: ');
  40.     REPEAT
  41.         ReadLn(choice1);
  42.       IF choice1 <> '1' THEN BEGIN
  43.           WriteLn('Sorry !');
  44.          WriteLn('This demo wasn''t written for more as 256 colors !');
  45.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  46.          WriteLn('Switching to 256 colors.');
  47.          choice1 := '1';
  48.       END;
  49.     UNTIL choice1 IN ['1'..'4','q'];
  50.     IF choice1 = 'q' THEN Halt;
  51.  
  52.     WriteLn;
  53.     WriteLn;
  54.     WriteLn('a. 320x200');
  55.     WriteLn('b. 640x480');
  56.     WriteLn('c. 800x600');
  57.     WriteLn('d. 1024x768');
  58.     WriteLn('e. 1280x1024');
  59.     WriteLn('Q uit');
  60.     WriteLn;
  61.     Write('Your choice: ');
  62.     REPEAT
  63.         ReadLn(choice2);
  64.     UNTIL choice2 IN ['a'..'e','q'];
  65.     IF choice2 = 'q' THEN Halt;
  66.  
  67.     CASE choice2 OF
  68.         'a' : BEGIN
  69.             xsize := 320;
  70.             ysize := 200;
  71.         END;
  72.         'b' : BEGIN
  73.             xsize := 640;
  74.             ysize := 480;
  75.         END;
  76.         'c' : BEGIN
  77.             xsize := 800;
  78.             ysize := 600;
  79.         END;
  80.         'd' : BEGIN
  81.             xsize := 1024;
  82.             ysize := 768;
  83.         END;
  84.         'e' : BEGIN
  85.             xsize := 1280;
  86.             ysize := 1024;
  87.         END;
  88.     END;
  89.     CASE choice1 OF
  90.         '1' : mode := FindVesaMode(xsize,ysize,8);
  91.         '2' : mode := FindVesaMode(xsize,ysize,15);
  92.         '3' : mode := FindVesaMode(xsize,ysize,16);
  93.         '4' : mode := FindVesaMode(xsize,ysize,24);
  94.     END;
  95.     IF mode = 0 THEN BEGIN
  96.         WriteLn('No such mode could be found !');
  97.         WriteLn('Switching to to 320x200.');
  98.         ReadKey;
  99.         mode := V320x200x256;
  100.     END;
  101. END;
  102.  
  103. begin { program body }
  104.   SelectMode;
  105.   Initialize;
  106.   ReportStatus;
  107.  
  108. {  AspectRatioPlay; }
  109.   FillEllipsePlay;
  110.   SectorPlay;
  111.   WriteModePlay;
  112.  
  113.   ColorPlay;
  114.   { PalettePlay only intended to work on these drivers: }
  115.   if (GraphDriver = EGA) or
  116.       (GraphDriver = EGA64) or
  117.       (GraphDriver = VGA) then
  118.      PalettePlay;
  119.   PutPixelPlay;
  120. {  PutImagePlay; }
  121.   RandBarPlay;
  122.   BarPlay;
  123.   Bar3DPlay;
  124.   ArcPlay;
  125.   CirclePlay;
  126.   PiePlay;
  127.   LineToPlay;
  128.   LineRelPlay;
  129. {  LineStylePlay; }
  130. {  UserLineStylePlay; }
  131.   TextDump;
  132.   TextPlay;
  133.   CrtModePlay;
  134.   FillStylePlay;
  135.   FillPatternPlay;
  136.   PolyPlay;
  137.   SayGoodbye;
  138. {  CloseGraph; }
  139.   CloseVesa;
  140. end.
  141. ***************************************************
  142.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  143.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  144. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  145. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  146. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  147. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  148.     Color := RandColor;
  149.     SetColor(Color);
  150.     SetFillStyle(Random(CloseDotFill)+1, Color);
  151.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  152.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  153.   until KeyPressed;
  154.   WaitToGo;
  155. end; { RandBarPlay }
  156.  
  157. procedure ArcPlay;
  158. { Draw random arcs on the screen }
  159. var
  160.   MaxRadius : word;
  161.   EndAngle : word;
  162.   ArcInfo : ArcCoordsType;
  163. begin
  164.   MainWindow('Arc / GetArcCoords demonstration');
  165.   StatusLine('Esc aborts or press a key');
  166.   MaxRadius := MaxY div 10;
  167.   repeat
  168.     SetColor(RandColor);
  169.     EndAngle := Random(360);
  170.     SetLineStyle(SolidLn, 0, NormWidth);
  171.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  172.     GetArcCoords(ArcInfo);
  173.     with ArcInfo do
  174.     begin
  175.       Line(X, Y, XStart, YStart);
  176.       Line(X, Y, Xend, Yend);
  177.     end;
  178.   until KeyPressed;
  179.   WaitToGo;
  180. end; { ArcPlay }
  181.  
  182. procedure PutPixelPlay;
  183. { Demonstrate the PutPixel and GetPixel commands }
  184. const
  185.   Seed   = 1962; { A seed for the random number generator }
  186.   NumPts = 2000; { The number of pixels plotted }
  187.   Esc    = #27;
  188. var
  189.   I : word;
  190.   X, Y, Color : word;
  191.   XMax, YMax  : integer;
  192.   ViewInfo    : ViewPortType;
  193. begin
  194.   MainWindow('PutPixel / GetPixel demonstration');
  195.   StatusLine('Esc aborts or press a key...');
  196.  
  197.   GetViewSettings(ViewInfo);
  198.   with ViewInfo do
  199.   begin
  200.     XMax := (x2-x1-1);
  201.     YMax := (y2-y1-1);
  202.   end;
  203.  
  204.   while not KeyPressed do
  205.   begin
  206.     { Plot random pixels }
  207.     RandSeed := Seed;
  208.     I := 0;
  209.     while (not KeyPressed) and (I < NumPts) do
  210.     begin
  211.       Inc(I);
  212.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  213.     end;
  214.  
  215.     { Erase pixels }
  216.     RandSeed := Seed;
  217.     I := 0;
  218.     while (not KeyPressed) and (I < NumPts) do
  219.     begin
  220.       Inc(I);
  221.       X := Random(XMax)+1;
  222.       Y := Random(YMax)+1;
  223.       Color := GetPixel(X, Y);
  224.         if Color = RandColor then
  225.           PutPixel(X, Y, 0);
  226.      end;
  227.   end;
  228.   WaitToGo;
  229. end; { PutPixelPlay }
  230.  
  231. procedure PutImagePlay;
  232. { Demonstrate the GetImage and PutImage commands }
  233.  
  234. const
  235.   r  = 20;
  236.   StartX = 100;
  237.   StartY = 50;
  238.  
  239. var
  240.   CurPort : ViewPortType;
  241.  
  242. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  243. var
  244.   Step : integer;
  245. begin
  246.   Step := Random(2*r);
  247.   if Odd(Step) then
  248.     Step := -Step;
  249.   X := X + Step;
  250.   Step := Random(r);
  251.   if Odd(Step) then
  252.     Step := -Step;
  253.   Y := Y + Step;
  254.  
  255.   { Make saucer bounce off viewport walls }
  256.   with CurPort do
  257.   begin
  258.     if (x1 + X + Width - 1 > x2) then
  259.       X := x2-x1 - Width + 1
  260.     else
  261.       if (X < 0) then
  262.         X := 0;
  263.     if (y1 + Y + Height - 1 > y2) then
  264.       Y := y2-y1 - Height + 1
  265.     else
  266.       if (Y < 0) then
  267.         Y := 0;
  268.   end;
  269. end; { MoveSaucer }
  270.  
  271. var
  272.   Pausetime : word;
  273.   Saucer    : pointer;
  274.   X, Y      : integer;
  275.   ulx, uly  : word;
  276.   lrx, lry  : word;
  277.   Size      : word;
  278.   I         : word;
  279. begin
  280.   ClearDevice;
  281.   FullPort;
  282.  
  283.   { PaintScreen }
  284.   ClearDevice;
  285.   MainWindow('GetImage / PutImage Demonstration');
  286.   StatusLine('Esc aborts or press a key...');
  287.   GetViewSettings(CurPort);
  288.  
  289.   { DrawSaucer }
  290.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  291.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  292.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  293.   Circle(StartX+10, StartY-12, 2);
  294.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  295.   Circle(StartX-10, StartY-12, 2);
  296.   SetFillStyle(SolidFill, MaxColor);
  297.   FloodFill(StartX+1, StartY+4, GetColor);
  298.  
  299.   { ReadSaucerImage }
  300.   ulx := StartX-(r+1);
  301.   uly := StartY-14;
  302.   lrx := StartX+(r+1);
  303.   lry := StartY+(r div 3)+3;
  304.  
  305.   Size := ImageSize(ulx, uly, lrx, lry);
  306.   GetMem(Saucer, Size);
  307.   GetImage(ulx, uly, lrx, lry, Saucer^);
  308. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  309.  
  310.   { Plot some "stars" }
  311.   for I := 1 to 1000 do
  312.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  313.   X := MaxX div 2;
  314.   Y := MaxY div 2;
  315.   PauseTime := 70;
  316.  
  317.   { Move the saucer around }
  318.   repeat
  319. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  320.      Delay(PauseTime);
  321. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  322.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  323.   until KeyPressed;
  324.   FreeMem(Saucer, size);
  325.   WaitToGo;
  326. end; { PutImagePlay }
  327.  
  328. procedure PolyPlay;
  329. { Draw random polygons with random fill styles on the screen }
  330. const
  331.   MaxPts = 5;
  332. type
  333.   PolygonType = array[1..MaxPts] of PointType;
  334. var
  335.   Poly : PolygonType;
  336.   I, Color : word;
  337. begin
  338.   MainWindow('FillPoly demonstration');
  339.   StatusLine('Esc aborts or press a key...');
  340.   repeat
  341.     Color := RandColor;
  342.     SetFillStyle(Random(11)+1, Color);
  343.     SetColor(Color);
  344.     for I := 1 to MaxPts do
  345.       with Poly[I] do
  346.       begin
  347.         X := Random(MaxX);
  348.         Y := Random(MaxY);
  349.       end;
  350.     FillPoly(MaxPts, Poly);
  351.   until KeyPressed;
  352.   WaitToGo;
  353. end; { PolyPlay }
  354.  
  355. procedure FillStylePlay;
  356. { Display all of the predefined fill styles available }
  357. var
  358.   Style    : word;
  359.   Width    : word;
  360.   Height   : word;
  361.   X, Y     : word;
  362.   I, J     : word;
  363.   ViewInfo : ViewPortType;
  364.  
  365. procedure DrawBox(X, Y : word);
  366. begin
  367.   SetFillStyle(Style, MaxColor);
  368.   with ViewInfo do
  369.     Bar(X, Y, X+Width, Y+Height);
  370.   Rectangle(X, Y, X+Width, Y+Height);
  371.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  372.   Inc(Style);
  373. end; { DrawBox }
  374.  
  375. begin
  376.   MainWindow('Pre-defined fill styles');
  377.   GetViewSettings(ViewInfo);
  378.   with ViewInfo do
  379.   begin
  380.     Width := 2 * ((x2+1) div 13);
  381.     Height := 2 * ((y2-10) div 10);
  382.   end;
  383.   X := Width div 2;
  384.   Y := Height div 2;
  385.   Style := 0;
  386.   for J := 1 to 3 do
  387.   begin
  388.     for I := 1 to 4 do
  389.     begin
  390.       DrawBox(X, Y);
  391.       Inc(X, (Width div 2) * 3);
  392.     end;
  393.     X := Width div 2;
  394.     Inc(Y, (Height div 2) * 3);
  395.   end;
  396.   SetTextJustify(LeftText, TopText);
  397.   WaitToGo;
  398. end; { FillStylePlay }
  399.  
  400. procedure FillPatternPlay;
  401. { Display some user defined fill patterns }
  402. const
  403.   Patterns : array[0..11] of FillPatternType = (
  404.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  405.             OldColor which has a path of pixels of OldColor or NewColor
  406.             with sides touching back to the seed point, (XSeed, YSeed).
  407.             Therefore, only pixels of OldColor are modified and no other
  408.             information is changed.
  409.  
  410.             SEE ALSO
  411.  
  412.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  413.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  414.             SETVIEW
  415.  
  416.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  417.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  418.             IF WHICHVGA = 0 THEN STOP
  419.             DUMMY=RES640
  420.             SETVIEW 100, 100, 539, 379
  421.             FILLVIEW 10
  422.             WHILE INKEY$ = ""
  423.             WEND
  424.             VIDEOMODESET VMODE
  425.             END
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.                                                                          63
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.           FONTGETINFO
  450.  
  451.             PROTOTYPE
  452.  
  453.             SUB FONTGETINFO (Width%, Height%)
  454.  
  455.             INPUT
  456.  
  457.             no input parameters
  458.     WEND
  459.             MOUSEEXIT
  460.             VIDEOMODESET VMODE
  461.             END
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.                                                                          86
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.           MOUSECURSORDEFAULT
  510.  
  511.             PROTOTYPE
  512.  
  513.             SUB MOUSECURSORDEFAULT ()
  514.  
  515.             INPUT
  516.  
  517.             no input parameters
  518.  
  519.             OUTPUT
  520.  
  521.             no value returned
  522.  
  523.             USAGE
  524.  
  525.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  526.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  527. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  528. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  529. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  530. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  531. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  532. $╤
  533. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  534. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  535. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  536. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  537. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  538. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  539. ░£▒
  540. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  541. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  542.       end;
  543.     end;
  544.   end;
  545.   WaitToGo;
  546. end; { UserLineStylePlay }
  547.  
  548.  
  549. procedure SayGoodbye;
  550. { Say goodbye and then exit the program }
  551. var
  552.   ViewInfo : ViewPortType;
  553. begin
  554.   MainWindow('');
  555.   GetViewSettings(ViewInfo);
  556.   SetTextStyle(TriplexFont, HorizDir, 4);
  557.   SetTextJustify(CenterText, CenterText);
  558.   with ViewInfo do
  559.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  560.   StatusLine('Press any key to quit...');
  561.   repeat until KeyPressed;
  562. end; { SayGoodbye }
  563.  
  564.  
  565. PROCEDURE SelectMode;
  566. VAR
  567.     choice1,choice2     : CHAR;
  568.    xsize,ysize            : WORD;
  569. BEGIN
  570.     (* Let's select a mode *)
  571.     ClrScr;
  572.     WriteLn('VESADEMO:');
  573.     WriteLn('1. 256 colors');
  574.     WriteLn('2. 32768 colors');
  575.     WriteLn('3. 65536 colors');
  576.     WriteLn('4. 16777216 colors');
  577.     WriteLn('Q uit');
  578.     WriteLn;
  579.     Write('Your choice: ');
  580.     REPEAT
  581.         ReadLn(choice1);
  582.       IF choice1 <> '1' THEN BEGIN
  583.           WriteLn('Sorry !');
  584.          WriteLn('This demo wasn''t written for more as 256 colors !');
  585.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  586.          WriteLn('Switching to 256 colors.');
  587.          choice1 := '1';
  588.       END;
  589.     UNTIL choice1 IN ['1'..'4','q'];
  590.     IF choice1 = 'q' THEN Halt;
  591.  
  592.     WriteLn;
  593.     WriteLn;
  594.     WriteLn('a. 320x200');
  595.     WriteLn('b. 640x480');
  596.     WriteLn('c. 800x600');
  597.     WriteLn('d. 1024x768');
  598.     WriteLn('e. 1280x1024');
  599.     WriteLn('Q uit');
  600.     WriteLn;
  601.     Write('Your choice: ');
  602.     REPEAT
  603.         ReadLn(choice2);
  604.     UNTIL choice2 IN ['a'..'e','q'];
  605.     IF choice2 = 'q' THEN Halt;
  606.  
  607.     CASE choice2 OF
  608.         'a' : BEGIN
  609.             xsize := 320;
  610.             ysize := 200;
  611.         END;
  612.         'b' : BEGIN
  613.             xsize := 640;
  614.             ysize := 480;
  615.         END;
  616.         'c' : BEGIN
  617.             xsize := 800;
  618.             ysize := 600;
  619.         END;
  620.         'd' : BEGIN
  621.             xsize := 1024;
  622.             ysize := 768;
  623.         END;
  624.         'e' : BEGIN
  625.             xsize := 1280;
  626.             ysize := 1024;
  627.         END;
  628.     END;
  629.     CASE choice1 OF
  630.         '1' : mode := FindVesaMode(xsize,ysize,8);
  631.         '2' : mode := FindVesaMode(xsize,ysize,15);
  632.         '3' : mode := FindVesaMode(xsize,ysize,16);
  633.         '4' : mode := FindVesaMode(xsize,ysize,24);
  634.     END;
  635.     IF mode = 0 THEN BEGIN
  636.         WriteLn('No such mode could be found !');
  637.         WriteLn('Switching to to 320x200.');
  638.         ReadKey;
  639.         mode := V320x200x256;
  640.     END;
  641. END;
  642.  
  643. begin { program body }
  644.   SelectMode;
  645.   Initialize;
  646.   ReportStatus;
  647.  
  648. {  AspectRatioPlay; }
  649.   FillEllipsePlay;
  650.   SectorPlay;
  651.   WriteModePlay;
  652.  
  653.   ColorPlay;
  654.   { PalettePlay only intended to work on these drivers: }
  655.   if (GraphDriver = EGA) or
  656.       (GraphDriver = EGA64) or
  657.       (GraphDriver = VGA) then
  658.      PalettePlay;
  659.   PutPixelPlay;
  660. {  PutImagePlay; }
  661.   RandBarPlay;
  662.   BarPlay;
  663.   Bar3DPlay;
  664.   ArcPlay;
  665.   CirclePlay;
  666.   PiePlay;
  667.   LineToPlay;
  668.   LineRelPlay;
  669. {  LineStylePlay; }
  670. {  UserLineStylePlay; }
  671.   TextDump;
  672.   TextPlay;
  673.   CrtModePlay;
  674.   FillStylePlay;
  675.   FillPatternPlay;
  676.   PolyPlay;
  677.   SayGoodbye;
  678. {  CloseGraph; }
  679.   CloseVesa;
  680. end.
  681. ***************************************************
  682.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  683.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  684. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  685. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  686. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  687. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  688.     Color := RandColor;
  689.     SetColor(Color);
  690.     SetFillStyle(Random(CloseDotFill)+1, Color);
  691.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  692.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  693.   until KeyPressed;
  694.   WaitToGo;
  695. end; { RandBarPlay }
  696.  
  697. procedure ArcPlay;
  698. { Draw random arcs on the screen }
  699. var
  700.   MaxRadius : word;
  701.   EndAngle : word;
  702.   ArcInfo : ArcCoordsType;
  703. begin
  704.   MainWindow('Arc / GetArcCoords demonstration');
  705.   StatusLine('Esc aborts or press a key');
  706.   MaxRadius := MaxY div 10;
  707.   repeat
  708.     SetColor(RandColor);
  709.     EndAngle := Random(360);
  710.     SetLineStyle(SolidLn, 0, NormWidth);
  711.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  712.     GetArcCoords(ArcInfo);
  713.     with ArcInfo do
  714.     begin
  715.       Line(X, Y, XStart, YStart);
  716.       Line(X, Y, Xend, Yend);
  717.     end;
  718.   until KeyPressed;
  719.   WaitToGo;
  720. end; { ArcPlay }
  721.  
  722. procedure PutPixelPlay;
  723. { Demonstrate the PutPixel and GetPixel commands }
  724. const
  725.   Seed   = 1962; { A seed for the random number generator }
  726.   NumPts = 2000; { The number of pixels plotted }
  727.   Esc    = #27;
  728. var
  729.   I : word;
  730.   X, Y, Color : word;
  731.   XMax, YMax  : integer;
  732.   ViewInfo    : ViewPortType;
  733. begin
  734.   MainWindow('PutPixel / GetPixel demonstration');
  735.   StatusLine('Esc aborts or press a key...');
  736.  
  737.   GetViewSettings(ViewInfo);
  738.   with ViewInfo do
  739.   begin
  740.     XMax := (x2-x1-1);
  741.     YMax := (y2-y1-1);
  742.   end;
  743.  
  744.   while not KeyPressed do
  745.   begin
  746.     { Plot random pixels }
  747.     RandSeed := Seed;
  748.     I := 0;
  749.     while (not KeyPressed) and (I < NumPts) do
  750.     begin
  751.       Inc(I);
  752.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  753.     end;
  754.  
  755.     { Erase pixels }
  756.     RandSeed := Seed;
  757.     I := 0;
  758.     while (not KeyPressed) and (I < NumPts) do
  759.     begin
  760.       Inc(I);
  761.       X := Random(XMax)+1;
  762.       Y := Random(YMax)+1;
  763.       Color := GetPixel(X, Y);
  764.         if Color = RandColor then
  765.           PutPixel(X, Y, 0);
  766.      end;
  767.   end;
  768.   WaitToGo;
  769. end; { PutPixelPlay }
  770.  
  771. procedure PutImagePlay;
  772. { Demonstrate the GetImage and PutImage commands }
  773.  
  774. const
  775.   r  = 20;
  776.   StartX = 100;
  777.   StartY = 50;
  778.  
  779. var
  780.   CurPort : ViewPortType;
  781.  
  782. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  783. var
  784.   Step : integer;
  785. begin
  786.   Step := Random(2*r);
  787.   if Odd(Step) then
  788.     Step := -Step;
  789.   X := X + Step;
  790.   Step := Random(r);
  791.   if Odd(Step) then
  792.     Step := -Step;
  793.   Y := Y + Step;
  794.  
  795.   { Make saucer bounce off viewport walls }
  796.   with CurPort do
  797.   begin
  798.     if (x1 + X + Width - 1 > x2) then
  799.       X := x2-x1 - Width + 1
  800.     else
  801.       if (X < 0) then
  802.         X := 0;
  803.     if (y1 + Y + Height - 1 > y2) then
  804.       Y := y2-y1 - Height + 1
  805.     else
  806.       if (Y < 0) then
  807.         Y := 0;
  808.   end;
  809. end; { MoveSaucer }
  810.  
  811. var
  812.   Pausetime : word;
  813.   Saucer    : pointer;
  814.   X, Y      : integer;
  815.   ulx, uly  :